<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.${moduleName}.controller;</#if>

<#if isAutoImport?exists && isAutoImport==true>
import ${packageName}.api.Result;
import ${packageName}.api.ResultWrapper;
import ${packageName}.${moduleName}.entity.${classInfo.className};
import ${packageName}.${moduleName}.qo.${classInfo.className}Condition;
import ${packageName}.qo.RequestCondition;
import ${packageName}.qo.RequestPageCondition;
import ${packageName}.${moduleName}.service.${classInfo.className}Service;
import io.swagger.annotations.ApiOperation;
import org.beetl.sql.core.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
</#if>
/**
 * @description ${classInfo.classComment}
 * @author ${authorName}
 * @date ${.now?string('yyyy-MM-dd')}
 */
@RestController
@RequestMapping("/${classInfo.className?uncap_first}")
public class ${classInfo.className}Controller {

    @Autowired
    private  ${classInfo.className}Service  ${classInfo.className?uncap_first}Service;

    @GetMapping(value = "/get")
    @ApiOperation("获取信息")
    public Result get(Long id) {
         ${classInfo.className}  ${classInfo.className?uncap_first} =  ${classInfo.className?uncap_first}Service.get(id);
        return ResultWrapper.isQueryOk( ${classInfo.className?uncap_first});
    }

    @GetMapping(value = "/page")
    @ApiOperation("根据条件获取分页信息")
    public Result page( ${classInfo.className}Condition  ${classInfo.className?uncap_first}Condition) {
        RequestPageCondition< ${classInfo.className},  ${classInfo.className}Condition> requestPageCondition = new RequestPageCondition( ${classInfo.className?uncap_first}Condition,  ${classInfo.className}.class);
        requestPageCondition.setPageSize( ${classInfo.className?uncap_first}Condition.getPageSize());
        requestPageCondition.setPageNumber( ${classInfo.className?uncap_first}Condition.getPageNumber());
        PageResult< ${classInfo.className}>  ${classInfo.className?uncap_first}Page =  ${classInfo.className?uncap_first}Service.page(requestPageCondition);
        return ResultWrapper.isQueryOk( ${classInfo.className?uncap_first}Page);
    }

    @GetMapping(value = "/list")
    @ApiOperation("根据条件获取列表信息")
    public Result list( ${classInfo.className}Condition  ${classInfo.className?uncap_first}Condition) {
        RequestCondition< ${classInfo.className},  ${classInfo.className}Condition> requestCondition = new RequestCondition( ${classInfo.className?uncap_first}Condition,  ${classInfo.className}.class);
        List< ${classInfo.className}>  ${classInfo.className?uncap_first}List =  ${classInfo.className?uncap_first}Service.list(requestCondition);
        return ResultWrapper.isQueryOk( ${classInfo.className?uncap_first}List);
    }

    @DeleteMapping("/del/{id}")
    @ApiOperation("根据ID删除信息")
    public Result del(@PathVariable Long id) {
        boolean deleteAffectedRows =  ${classInfo.className?uncap_first}Service.delete(id);
        return ResultWrapper.isOk(deleteAffectedRows);
    }

    @PutMapping("/update/{id}")
    @ApiOperation("根据ID删除信息")
    public Result update(@PathVariable Long id,  ${classInfo.className}  ${classInfo.className?uncap_first}) {
        boolean updateAffectedRows =  ${classInfo.className?uncap_first}Service.update( ${classInfo.className?uncap_first});
        return ResultWrapper.isOk(updateAffectedRows);
    }
}
